// 用户相关的接口封装
import request from '@/utils/request'
import store from '@/store/index'

console.log('****************')
console.log(store)
// 登录接口的请求方法
export function login (data) {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}

export function getSmsCode (mobile) {
  return request({
    method: 'GET',
    url: `/v1_0/sms/codes/${mobile}`
    // head
  })
}

// 获取用户信息的接口
export function getUserInfo () {
  // console.log()
  console.log(store.state.user.token)
  return request({
    method: 'GET',
    url: '/v1_0/user'
    // headers: {
    //   Authorization: `Bearer ${store.state.user.token}`
    // }
  })
}

// 定义获取频道的接口
export function getChannels () {
  return request({
    method: 'GET',
    url: '/v1_0/user/channels'
  })
}
